import { createApp } from 'vue'
import Antd from 'ant-design-vue'
import { createPinia } from 'pinia'

import './style/index.less'
import snowy from './snowy'
import i18n from './locales'
import router from './router'
import App from './App.vue'
import './tailwind.css'

import 'virtual:svg-icons-register'
// 全局组件可以src/components/global全局动态解析注册，这里只是直接引入注册
import svgIcon from './components/SvgIcon/index.vue'

import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 纯前端实现自动更新检测
import './auto-update.js'

const app = createApp(App)
app.use(createPinia())
app.use(router)
app.use(Antd)
app.use(i18n)
app.use(snowy)
app.use(ElementPlus, {
	locale: zhCn
})

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
	app.component('el-icon-' + key, component)
}

app
	.component('SvgIcon', svgIcon)
	// 挂载app
	.mount('#app')
